package exam;

import java.util.ArrayList;
import java.util.List;

/**
 * Tests the answer to the first sorting question.
 * The text of the question is as follows:
 * "Write a method that takes two sorted List<E> instances and then removes and returns the 
 *  smallest element of the two Lists.  If both lists are empty, then return null."
 * 
 * @author Branden Ogata
 *
 */

public class TestSortA00 extends Tester
{
  public static void main(String[] args)
  {
    final double POINTS = getPoints(args);
    List<Integer> left = new ArrayList<Integer>();
    List<Integer> right = new ArrayList<Integer>();

    System.out.println(test(Category.IS_NULL, "removeSmallest([], [])", 
                            null, SortA00.removeSmallest(left, right), 
                            percentageToPoints(TENTH, POINTS)));
    left.clear(); 
    right.clear();
    
    left.add(1);
    System.out.println(test(Category.EQUALS, "removeSmallest([1], [])", 
                            1, SortA00.removeSmallest(left, right), 
                            percentageToPoints(TENTH, POINTS)));
    left.clear(); 
    right.clear();
    
    right.add(2);
    System.out.println(test(Category.EQUALS, "removeSmallest([], [2])", 
                            2, SortA00.removeSmallest(left, right), 
                            percentageToPoints(TENTH, POINTS)));
    left.clear(); 
    right.clear();
    
    left.add(3);
    right.add(4);
    System.out.println(test(Category.EQUALS, "removeSmallest([3], [4])", 
                            3, SortA00.removeSmallest(left, right), 
                            percentageToPoints(TENTH, POINTS)));
    left.clear(); 
    right.clear();   

    left.add(6);
    right.add(5);
    System.out.println(test(Category.EQUALS, "removeSmallest([6], [5])", 
                            5, SortA00.removeSmallest(left, right), 
                            percentageToPoints(TENTH, POINTS)));
    left.clear(); 
    right.clear();    

    left.add(7);
    left.add(9);
    right.add(8);
    System.out.println(test(Category.EQUALS, "removeSmallest([7, 9], [8])", 
                            7, SortA00.removeSmallest(left, right), 
                            percentageToPoints(TENTH, POINTS)));
    left.clear(); 
    right.clear();    
    
    left.add(2);
    right.add(0);
    right.add(1);
    System.out.println(test(Category.EQUALS, "removeSmallest([2], [0, 1])", 
                            0, SortA00.removeSmallest(left, right), 
                            percentageToPoints(TENTH, POINTS)));
    left.clear(); 
    right.clear();    
    
    left.add(3);
    left.add(5);
    right.add(4);
    right.add(6);
    System.out.println(test(Category.EQUALS, "removeSmallest([3, 5], [4, 6])", 
                            3, SortA00.removeSmallest(left, right), 
                            percentageToPoints(TENTH, POINTS)));
    left.clear(); 
    right.clear();    

    left.add(9);
    left.add(10);
    right.add(7);
    right.add(8);
    System.out.println(test(Category.EQUALS, "removeSmallest([9, 10], [7, 8])", 
                            7, SortA00.removeSmallest(left, right), 
                            percentageToPoints(TENTH, POINTS)));
    left.clear(); 
    right.clear();    

    List<String> leftStringList = new ArrayList<String>();
    List<String> rightStringList = new ArrayList<String>();
    leftStringList.add("alpha");
    leftStringList.add("beta");
    rightStringList.add("gamma");
    rightStringList.add("delta");
    System.out.println(test(Category.EQUALS, "removeSmallest([\"alpha\", \"beta\"], " +
    		                                     "[\"gamma\", \"delta\"])", 
    		                    "alpha", SortA00.removeSmallest(leftStringList, rightStringList), 
    		                    percentageToPoints(TENTH, POINTS)));
    left.clear(); 
    right.clear();    
    
    System.out.format("[%.2f/%.2f]%n", getTotalPoints(), POINTS);
  }
}
